

<template>
    <div class="userAgreement">
        <Row>
            <Col span="24">
                <h2 class="ivu-modal-header">用户协议</h2>
                <div class="mt-10">
                    <quill-editor v-model="userAgreementForm.userAgreement"
                    ref="myQuillEditor" >
                    </quill-editor>
                </div>
            </Col>
            <Col span="24" class="ta-c">
                   <Button type="primary" @click="submitBasic">提交</Button>
                <Button @click="closeBasic">取消</Button>
            </Col>
        </Row>
         <Spin size="large" fix v-show="showSpin">
            请稍后....
        </Spin>
    </div>
</template>
<script>
    export default {
        name: 'userAgreement',
        props: ['shopIds'],
        data () {
            return {
                shopId: '',
                showSpin: false,
                userAgreementForm: {
                    userAgreement: ''
                }

            };
        },
        mounted () {
            this.shopId = this.$route.query.id;
            this.findShop();
        },
        methods: {
            findShop () {
                depot.get({
                    url: this.URL.EC_SELLER.SHOP_FIND_ID + '?id=' + this.shopId,
                    cb: (data) => {
                        if (data.code === 0) {
                            this.userAgreementForm = data.data;
                        }
                    },
                    ce: (error) => {
                        this.$Message.error(data.message);
                    }
                });
            },
            closeBasic () {},
            submitBasic () {
                this.userAgreementForm.shopId = this.shopId;
                this.showSpin = true;
                depot.post({
                    url: this.URL.EC_SELLER.UPDATE_SHOP_SETTINGS,
                    data: this.userAgreementForm,
                    cb: (data) => {
                        // this.showSpin = false;
                        if (data.code === 0) {
                            this.$Message.success('提交成功');
                            this.showSpin = false;
                            this.findShop();
                        } else{
                            // this.$Message.error(data.message);
                            this.showSpin = false;
                        }
                    }
                });
            }
        },
        watch: {
            shopIds (newVal, oldVal) {
                if (newVal) {
                    this.shopId = newVal;
                    this.findShop();
                }
                console.log(this.shopId, 'ppp');
            }
        }
    };
</script>
<style lang="less" scoped>
    .userAgreement{
        /deep/.ql-editor{
        }
        
    }
</style>

